home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr27 / setdatec.zip / SETDATE.TXT < prev    next >
Text File  |  1994-12-29  |  10KB  |  303 lines

  1.  
  2. SETDATE.TXT               Version 1.C                           1994.12.29
  3. ───────────                                                     ──────────
  4.  
  5. sample data:
  6. YR MTH DAY HR MIN SEC HTH DOW DL TODAY DFS
  7. LY NY TDAY UDAY CM CD WOY NM
  8. P4 3 8 P5 720 880 AD5 1 AD3 -30      =
  9.  
  10. Those variables that the user wants to have in his environment are found
  11. before the first "=" sign at the start of this file. SETDATE.COM reads 
  12. this documentation file to determine which of the variables is required,
  13. or uses one parameter. 
  14.  
  15. The set of possible variables is:
  16.  
  17. YR MTH DAY HR MIN SEC HTH DOW D3 DL TODAY TMTH UMTH DFS DTE WOM NS
  18. LY NY CENT TH UH TM UM TS US THU UHU 12H TDAY UDAY CM CD WOY NM MX
  19. P0, P1..P9  AD0, AD1..AD9
  20.  
  21. The P variables (period) are P0, P1 to P9 and are used as period indicators.
  22. If one of these is used, it must be followed by 2 numbers representing the 
  23. start and end of the period. if the numbers are both <= 24, the numbers are
  24. taken as hours, otherwise they are taken as minutes. If your data is 
  25. P4 12 14, you will get an output of SET P4=Y if the program is run between 
  26. 12:00 and 14:00 hrs, and SET P4=N otherwise. You can have a period extending 
  27. past midnight with numbers like 23 7.
  28.  
  29. Variables AD0, AD1..AD9 (Another Date) enable you to get the day, month and
  30. year of a date which is a given number of days from the present. AD3 1
  31. will give something similar to
  32.    SET AD3D=23
  33.    SET AD3M=08
  34.    SET AD3Y=94
  35. representing tomorrow's date.
  36.  
  37. Previous dates are found by using negative numbers - the date 30 days 
  38. ago is given by using a negative value of 30 (AD8 -30).
  39.  
  40. Use of time and date environment variables:-
  41.  
  42. Having parts of the date and time in environment variables is handy when
  43. making backups, or otherwise naming files or directories according to date.
  44. The program SETDATE results in an output which may be redirected to make
  45. a batch file, which then is CALLed to create the nominated environment 
  46. variables as described below. You can change the behaviour of a batch
  47. file depending on the time of day by using the period variables.
  48.  
  49. SETDATE provides time variables down to hundredths of seconds and has a ready-
  50. made combination called TODAY which may be convenient.  The DOW (Day Of Week) 
  51. variable is available at 2 characters to enable a file name like 941205Tu.txt 
  52. to be made. A 3 character day and long version of day are available. Minutes 
  53. or seconds may be useful in doing intermediate backups of source code when 
  54. compiling via a batch file and can be used several times per day. Hundredths 
  55. may be useful in providing a random seed for games, display of screens or 
  56. other events. 
  57.  
  58. The program stops and warns if the system year is not at least 1994.
  59.  
  60. Ways to use SETDATE are shown in examples below.
  61.  
  62. If any of the variable names appear at the start of this file before "="
  63. and the program is run from the same directory as the documentation file 
  64. (or consider using the APPEND command), those variables will be written 
  65. out with the current data (so keep a standard list and just copy it to 
  66. the top and edit it there). Order and spacing do not matter, case does 
  67. (so you could include a lower case note in the list). 
  68.  
  69. From version 1.C, a parameter may be used. If present, this will be used 
  70. and the file will not be read. This is useful in case only a few variables 
  71. are required. E.g. 
  72.  
  73.       SETDATE "TODAY P 8 17 AD5 -90
  74.  
  75. The trailing quote is not required (in DOS 5). 
  76.  
  77. Just run the program to see what your selection will bring. When 
  78. satisfactory, redirect it to a batch file and call it. If most names 
  79. are used, the output looks something like this:
  80.  
  81. SET TODAY=940515
  82. SET YR=94
  83. SET TMTH=0
  84. SET UMTH=5
  85. SET MTH=05
  86. SET MX=5
  87. SET THU=6
  88. SET UHU=0
  89. SET HTH=60
  90. SET TDAY=1
  91. SET UDAY=5
  92. SET NM=0803
  93. SET WOM=3
  94. SET DAY=15
  95. SET HR=13
  96. SET TH=1
  97. SET UH=3
  98. SET 12H=1
  99. SET MIN=23
  100. SET TM=2
  101. SET UM=3
  102. SET SEC=37
  103. SET TS=3
  104. SET US=7
  105. SET LY=1993
  106. SET NY=1995
  107. SET CENT=19
  108. SET DOW=Su
  109. SET D3=Sun
  110. SET DL=Sunday
  111. SET CD=u
  112. SET CM=y
  113. SET DFS=135
  114. SET WOY=20
  115. SET DTE=230
  116. SET NS=06774
  117.  
  118. but you will probably want to be selective about what to include.
  119.  
  120. ---------------------------------------------------------------------------
  121. SETTODAY may called from the AUTOEXEC.BAT file but in addition, may be called
  122. from any other batch file or run separately.
  123.  
  124. This file, SETTODAY.BAT or something like it, is what is required to make 
  125. the variables (the directory \UTIL contains SETDATE.DOC and there is a 
  126. path to SETDATE.COM):
  127.  
  128.      :settoday.bat
  129.      rem change directory to where the data file is
  130.      cd\util
  131.      setdate >c:\setdate.bat
  132.      call c:\setdate
  133. ---------------------------------------------------------------------------
  134.  
  135. EXAMPLES:
  136. ─────────
  137. :File: ec.bat
  138. rem Edit the file of data captured from the bulletin board, then rename.
  139. ed caught.txt/e
  140. ren caught.txt %yr%%mth%%day%%min%.txt
  141.  
  142.  
  143. :File: nl.bat
  144. :new letter
  145. rem A 2 character command line parameter is allowed to enable the creation 
  146. rem of lots of letters every day. The $ in the directory name makes it sort
  147. rem to the top of the tree.
  148. ed c:\$geoff\%yr%%mth%%day%%1.txt 
  149.  
  150.  
  151. :dt.bat          G.Cutter        93.11.08
  152. :done today
  153. :(for Australia - order the variables to suit your country)
  154. dir /on |find "%day%-%mth%-%yr%"
  155.  
  156.  
  157. @echo off
  158. :test.bat                  G.Cutter                     93.01.10
  159. :                                           Data was P8   15 19
  160. rem "Display the file if in period 8"
  161. if .%P8%==.Y goto showit
  162. goto missit
  163. :showit
  164. type c:\config.sys
  165. pause
  166. :missit
  167.  
  168. @echo off
  169. :setmthc.bat          Geoff Cutter           94-07-13
  170. REM Useful in making a ORACLE type date (13-JUL-94)
  171. if %mth%==01 set MTHC=JAN
  172. if %mth%==02 set MTHC=FEB
  173. if %mth%==03 set MTHC=MAR
  174. if %mth%==04 set MTHC=APR
  175. if %mth%==05 set MTHC=MAY
  176. if %mth%==06 set MTHC=JUN
  177. if %mth%==07 set MTHC=JUL
  178. if %mth%==08 set MTHC=AUG
  179. if %mth%==09 set MTHC=SEP
  180. if %mth%==10 set MTHC=OCT
  181. if %mth%==11 set MTHC=NOV
  182. if %mth%==12 set MTHC=DEC
  183.  
  184.  
  185. To increase environment space, if required, try
  186.      shell=c:\command.com /p /e:877
  187. in the CONFIG.SYS file and restart the computer.
  188.  
  189.        LY=Last year -          2 characters
  190.        NY=Next year -          2 characters
  191.        CENT=Century -          2 characters
  192.        TH=Tens of hours -      1 character
  193.        UH=Units of hours -     1 character
  194.        TM=Tens of minutes -    1 character
  195.        UM=Units of minutes -   1 character
  196.        TS=Tens of seconds -    1 character
  197.        US=Units of seconds -   1 character
  198.        TDAY = Tens of days -   1 character
  199.        UDAY = Units of days  - 1 character
  200.        TMTH = Tens of month  - 1 character
  201.        UMTH = Units of month - 1 character
  202.        THU=Tens of hundredths of seconds - 1 character
  203.        UHU=Units of hundredths of seconds - 1 character
  204.        12H=Hours (12 Hour time) - 2 characters
  205.        NS=Seconds so far today  - 5 characters
  206.        CM=Character for Month   - 1 character       see below
  207.        CD=Character for Day     - 1 character       see below
  208.  
  209.        Monday     writes "m"      when CD is in the list
  210.        Tuesday    writes "t"
  211.        Wednesday  writes "w"
  212.        Thursday   writes "h"
  213.        Friday     writes "f"
  214.        Saturday   writes "s"
  215.        Sunday     writes "u"
  216.  
  217.        January    writes "j"      when CM is in the list
  218.        February   writes "f"   
  219.        March      writes "m"   
  220.        April      writes "a"
  221.        May        writes "y"
  222.        June       writes "u"
  223.        July       writes "l"
  224.        August     writes "g"
  225.        September  writes "s"
  226.        October    writes "o"
  227.        November   writes "n"
  228.        December   writes "d" 
  229.  
  230.        DFS    -  Days From Start of year  - 3 characters
  231.        DTE    -  Days To End of year      - 3 characters
  232.  
  233.        WOM=Week Of Month - 1 digit (for such things as the 3rd 
  234.        Thursday in the month.)
  235.  
  236.        WOY=Week Of Year - 2 digits
  237.  
  238.        NM=Number of Minutes so far today - 4 digits
  239.  
  240.        P0-P9 - logical output (Y or N) depending on time of day for 
  241.        up to 10 periods
  242.  
  243.        MX=Month of year in hex. Useful if a single character is required 
  244.        for a month so that file extentions can be made up from %MX%%DAY%
  245.  
  246.        AD0-AD9 - with a following number, outputs a date representing the 
  247.        date which is that number of days away from the present date (+ or -).
  248. ---------------------------------------------------------------------------
  249. I have changed some code concerning Pn since version A as I can't get the 
  250. concatenate function to work properly. I now just use substitution instead,
  251. here and for AD.
  252.  
  253. Some of the numbers are limited to 32k, eg the number of days from the
  254. the system date that the program will work for. I might fix this next time.
  255. In the mean time, 87 years will have to do.
  256.  
  257. In this version I have taken out the HALT when the system date is not
  258. at least as much as the compile date. This is to enable the program to 
  259. generate a suitable date for an XT knowing the number of days from 1980-1-1.
  260. A message appears as a remark in the output if appropriate so as not to 
  261. prevent batch file operation.
  262.  
  263. What I am working on (obviously unfinished) now is:
  264.  
  265. @echo off
  266. :incnum.bat                   Geoff Cutter             94-09-17
  267. REM D: is a RAM drive
  268. d:
  269. copy incnum.bat c:\batch
  270. if not exist *.gcc goto explain
  271. dir *.gcc |find /i "GCC" >count.$$$
  272. del *.gcc
  273. strings gcc= read count.$$$,1
  274. strings gcc2= parse %gcc%,1,
  275. set gcc=
  276. strings gcc3= add %gcc2%,1
  277. rem >%gcc3%.gcc
  278. echo AD5 %gcc3% =>c:\temp\setdate.doc
  279. type c:\util\setdate.doc >>c:\temp\setdate.doc
  280. c:
  281. cd\temp
  282. setdate
  283.  
  284. goto end
  285.  
  286. :explain
  287. echo  This batch file takes a file name which is a number and 
  288. echo  increments it and saves it to the new value. Useful if 
  289. echo  you have an XT and wish to have an approx date (days 
  290. echo  from 80-01-01). Knowing the days, use SETDATE to find
  291. echo  the date that number of days from there. If this is 
  292. echo  done once every day, the date will be correct on the XT.
  293. echo  Use a variable such as AD5 in SETDATE to set up variables
  294. echo  for setting the date.
  295.  
  296. echo A file of the form NNNN.GCC should exist where NNNN is the number
  297. echo to be incremented.
  298. echo A file has been created for you for testing. Run %0 again.
  299. rem >8.gcc
  300. :end
  301.  
  302. ---------------------------------------------------------------------------
  303.